1

[root@docker-1 ~]# docker ps 查看正在运行的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@docker-1 ~]# docker ps -a 查看所有容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@docker-1 ~]# docker run centos # 运行容器
Unable to find image 'centos:latest' locally
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
a02a4930cb5d: Pull complete
Digest: sha256:184e5f35598e333bfa7de10d8fb1cebb5ee4df5bc0f970bf2b1e7c7345136426
Status: Downloaded newer image for docker.io/centos:latest
[root@docker-1 ~]#
[root@docker-1 ~]# docker tag centos centos:v1
[root@docker-1 ~]# docker rmi centos
Untagged: centos:latest
[root@docker-1 ~]#
[root@docker-1 ~]# docker run -t centos:v1 # 模拟终端
[root@39433d36fdde /]#
[root@docker-1 ~]# docker run -t -i centos:v1 -i与终端交互
[root@2e2252de30ce /]#
[root@2e2252de30ce /]# ls
anaconda-post.log dev home lib64 mnt proc run srv tmp var
bin etc lib media opt root sbin sys usr
[root@2e2252de30ce /]#
[root@2e2252de30ce /]# exit
exit
[root@docker-1 ~]# docker run -it centos:v1


吴永袁
3 声望0 粉丝